

class Handle(object):

    @staticmethod
    def from_(x):
        if hasattr(x, "fileno"):
            return x
        if isinstance(x, int):
            return Handle(x)
        raise ValueError, "incompatible 'x'"


    def __init__(self, fileno):
        self._fileno = fileno


    def fileno(self):
        return self._fileno
